import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '镜像名称',
    align: "center",
    dataIndex: 'name',
    resizable:true
  },
  {
    title: '镜像地址',
    align: "center",
    dataIndex: 'hubUrl',
    resizable:true
  },
  {
    title: '创建容器超时时间(s)',
    align: "center",
    dataIndex: 'createTimeOut',
    resizable:true
  },
  {
    title: '启动容器时的启动命令',
    align: "center",
    dataIndex: 'command',
    resizable:true
  },
  {
    title: '审核状态',
    align: "center",
    dataIndex: 'status',
    resizable:true
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据 
export const formSchema: FormSchema[] = [
  {
    label: '镜像对应的id',
    field: 'imageId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      console.log(model,schema)
      return [
              { required: true, message: '请输入镜像对应的id!'},
             ];
    },
  },
  {
    label: '镜像名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      console.log(model,schema)
      return [
              { required: true, message: '请输入镜像名称!'},
             ];
    },
  },
  {
    label: '镜像在仓库中的url地址',
    field: 'hubUrl',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      console.log(model,schema)
      return [
              { required: true, message: '请输入镜像在仓库中的url地址!'},
             ];
    },
  },
  {
    label: '请输入此镜像需要暴露的端口号,当有多个时用逗号进行分割,例如22,8080',
    field: 'ports',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      console.log(model,schema)
      return [
              { required: true, message: '请输入需要映射的端口'},
             ];
    },
  },
  {
    label: '基于此镜像创建容器时的最长超时时间',
    field: 'createTimeOut',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      console.log(model,schema)
      return [
              { required: true, message: '请输入基于此镜像创建容器时的最长超时时间!'},
             ];
    },
  },
  {
    label: '启动容器时的启动命令',
    field: 'command',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      console.log(model,schema)
      return [
              { required: true, message: '请输入启动容器时的启动命令!'},
             ];
    },
  },
  {
    label: '镜像描述',
    field: 'description',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      console.log(model,schema)
      return [
              { required: true, message: '请输入镜像描述!'},
             ];
    },
  },
  {
    label: '审核状态.0:待提交,1:待审核,2:通过,3:不通过 ',
    field: 'status',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      console.log(model,schema)
      return [
              { required: true, message: '请输入审核状态.0:待提交,1:待审核,2:通过,3:不通过 !'},
             ];
    },
  },
  {
    label: '审核人',
    field: 'reviewer',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      console.log(model,schema)
      return [
              { required: true, message: '请输入审核人!'},
             ];
    },
  },
  {
    label: '审核时间',
    field: 'reviewTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      console.log(model,schema)
      return [
              { required: true, message: '请输入审核时间!'},
             ];
    },
  },
  {
    label: '审核意见',
    field: 'reviewMsg',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      console.log(model,schema)
      return [
              { required: true, message: '请输入审核意见!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
